package com.sky.api.client;


import com.sky.entity.AddressBook;
import com.sky.entity.User;
import com.sky.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.time.LocalDateTime;
import java.util.Map;

@FeignClient("user-service")
public interface UserClient {
    /**
     * 根据用户id查询用户信息
     * @param id
     * @return
     */
    @GetMapping("/user/user/{id}")
    @ApiOperation("根据用户id查询用户信息")
    public User getUserById(@PathVariable("id") Long id);

    @GetMapping("/user/user/{id}")
    @ApiOperation("根据id查询地址")
    public Result<AddressBook> getById(@PathVariable Long id);

    /**======================
     * 根据时间区间统计用户数量

     * @return
     */
    @GetMapping("/user/user/count")
    @ApiOperation("根据时间区间统计用户数量")
    public Integer countByMap(@RequestBody Map<String, LocalDateTime> map);

}
